package br.ucb.gafs.jimagefun;

import java.awt.Image;
import java.awt.Rectangle;
import java.util.List;

public enum Position {
	FACE{
		@Override
		public void drawIn(Image imagem, List<Rectangle> faces, FunPic funPic) {
			for (Rectangle rectangle : faces){
				imagem.getGraphics().drawImage(funPic.getImage(), 
						(int) (rectangle.getX()+(rectangle.getWidth()*funPic.getXProp())), 
						(int) (rectangle.getY()+(rectangle.getHeight()*funPic.getYProp())), 
						(int) (rectangle.getWidth()*funPic.getWidthProp()), 
						(int) (rectangle.getHeight()*funPic.getHeightProp()), 
						null);
			}
		}
	},
	BOTTOM_LEFT{
		@Override
		public void drawIn(Image imagem, List<Rectangle> faces, FunPic funPic) {
			imagem.getGraphics().drawImage(funPic.getImage(), 
					funPic.getXProp().intValue(), 
					imagem.getWidth(null)-funPic.getWidthProp().intValue()+funPic.getYProp().intValue(), 
					funPic.getWidthProp().intValue(), 
					funPic.getHeightProp().intValue(), 
					null);
		}
	},
	BOTTOM_RIGHT{
		@Override
		public void drawIn(Image imagem, List<Rectangle> faces, FunPic funPic) {
			imagem.getGraphics().drawImage(funPic.getImage(), 
					imagem.getWidth(null)-funPic.getWidthProp().intValue()+funPic.getXProp().intValue(), 
					imagem.getHeight(null)-funPic.getHeightProp().intValue()+funPic.getYProp().intValue(), 
					funPic.getWidthProp().intValue(), 
					funPic.getHeightProp().intValue(), 
					null);
		}
	},
	TOP_LEFT{
		@Override
		public void drawIn(Image imagem, List<Rectangle> faces, FunPic funPic) {
			imagem.getGraphics().drawImage(funPic.getImage(), 
					funPic.getXProp().intValue(), 
					funPic.getYProp().intValue(), 
					funPic.getWidthProp().intValue(), 
					funPic.getHeightProp().intValue(), 
					null);
		}
	},
	TOP_RIGHT{
		@Override
		public void drawIn(Image imagem, List<Rectangle> faces, FunPic funPic) {
			imagem.getGraphics().drawImage(funPic.getImage(), 
					imagem.getWidth(null)-funPic.getWidthProp().intValue()+funPic.getXProp().intValue(), 
					funPic.getYProp().intValue(), 
					funPic.getWidthProp().intValue(), 
					funPic.getHeightProp().intValue(), 
					null);
		}
	};
	
	public abstract void drawIn(Image imagem, List<Rectangle> faces, FunPic funPic);
}
